package com.hsc.www;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@RestController
@RequestMapping("student")
@Api(value="学生操作接口|StudentController" ,tags = {"dfdfdf"})
public class StudentController {

    @GetMapping("getStudent/{id}")
    @ApiOperation(value = "根据 id 查询学生！")
    public Student getStudent(@PathVariable  Long id)
    {
        Student student= new Student();
        student.setId(id);
        student.setName(UUID.randomUUID().toString());
        student.setAge(89);
        return student;
    }

    @PostMapping("postStudent")
    @ApiOperation(value = "添加学生！")
    public String postStudent(@RequestBody  Student student)
    {
        return "添加成功";
    }

    @PutMapping("putStudent")
    @ApiOperation(value = "修改学生！")
    public String putStudent(@RequestBody  Student student)
    {
        return "修改成功";
    }


    @DeleteMapping("deleteStudent/{id}")
    @ApiOperation(value = "根据 id 删除学生！")
    public String deleteStudent(@PathVariable  Long id)
    {
        return "删除成功 id="+id;
    }


}
